﻿@{
    Layout = null;
}

<link href="~/libs/layui-v2.9.21/layui/css/layui.css" rel="stylesheet" />

<form class="layui-form" action="">
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">仓库</label>
			<div class="layui-input-inline layui-input-wrap">
				<select id="repositoryId" name="repositoryId">
					<option value="">请选择</option>
					<option value="1">普通仓库</option>
					<option value="2">特殊仓库</option>
				</select>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">所属客户</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="customer" lay-verify="required" placeholder="请输入客户" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item layui-form-text">
		<div class="layui-inline">
			<label class="layui-form-label">库位编码</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="theLocationCode" lay-verify="required" placeholder="请输入库位编码" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">库位条码</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="theLocationBarcode" lay-verify="required" placeholder="请输入库位条码" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">库位类型</label>
			<div class="layui-input-wrap layui-input-inline">
				<select id="theLocationType" name="theLocationType">
					<option value="">请选择</option>
					<option value="1">普通库位</option>
					<option value="2">特殊库位</option>
				</select>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">库位属性</label>
			<div class="layui-input-wrap layui-input-inline">
				<select id="binLocationAttributes" name="binLocationAttributes">
					<option value="">请选择</option>
					<option value="1">库位大小</option>
					<option value="2">库位位置</option>
				</select>
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">产品属性</label>
			<div class="layui-input-wrap layui-input-inline">
				<select id="productAttributes" name="productAttributes">
					<option value="">请选择</option>
					<option value="1">感性产品</option>
					<option value="2">理性产品</option>
				</select>
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">上架次序</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="number" lay-affix="number" id="listingOrder" name="listingOrder" placeholder="" value="0" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">取货次序</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="number" lay-affix="number" id="pickupOrder" name="pickupOrder" placeholder="" value="0" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">最大重量</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="maxWeight" id="maxWeight" lay-verify="required" placeholder="请输入最大重量" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">最大托盘</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="largestPallets" id="largestPallets" lay-verify="required" placeholder="请输入最大托盘" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">宽</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="wide" id="wide" lay-verify="required" placeholder="请输入宽" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">长</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="long" id="long" lay-verify="required" placeholder="请输入长" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">高</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="high" id="high" lay-verify="required" placeholder="请输入高" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">最大体积</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="maxVolume" id="maxVolume" lay-verify="required" placeholder="请输入最大体积" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">停用</label>
			<div class="layui-input-wrap layui-input-inline">
				<select id="deactivated" name="deactivated">
					<option value="">请选择</option>
					<option value="1">是</option>
					<option value="2">否</option>
				</select>
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">备注</label>
		<div class="layui-input-block">
			<textarea id="remark" name="remark" lay-verify="required" placeholder="请输入备注" class="layui-input"></textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">动线</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="circulation" id="circulation" lay-verify="required" placeholder="请输入动线" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">电子标签ID</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="elabelId" id="elabelId" lay-verify="required" placeholder="请输入电子标签ID" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">最小批量</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="minLotSize" id="minLotSize" lay-verify="required" placeholder="请输入最小批量" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">最大批量</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="maxLotSize" id="maxLotSize" lay-verify="required" placeholder="请输入最大批量" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">出库口</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="outboundPort" id="outboundPort" lay-verify="required" placeholder="请输入出库口" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">储位组别</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="locationGroup" id="locationGroup" lay-verify="required" placeholder="请输入储位组别" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">X坐标</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="xcoordinates" id="xcoordinates" lay-verify="required" placeholder="请输入X坐标" class="layui-input">
			</div>
		</div>
		<div class="layui-inline">
			<label class="layui-form-label">Y坐标</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="ycoordinates" id="ycoordinates" lay-verify="required" placeholder="请输入Y坐标" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-inline">
			<label class="layui-form-label">Z坐标</label>
			<div class="layui-input-wrap layui-input-inline">
				<input type="text" name="zcoordinates" id="zcoordinates" lay-verify="required" placeholder="请输入Z坐标" class="layui-input">
			</div>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block">
			<button type="submit" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
			<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>

<script src="~/libs/layui-v2.9.21/layui/layui.js"></script>
<script src="~/libs/jquery/jquery.js"></script>

<script>
	layui.use(['form', 'laydate'], function(){
	  var form = layui.form;
	  var layer = layui.layer;
	  var laydate = layui.laydate;

	  // 自定义验证规则
	  form.verify({
		pass: function(value) {

		}
	  });

	  // 提交事件
	  form.on('submit(demo1)', function(data){
		var field = data.field; // 获取表单字段值
		// 此处可执行 Ajax 等操作
		console.log(field)
		$.ajax({
			url:'/Puff/AddBinlocationdatas',
		   data:field,
		   type:'post',
		   dataType:'json',
		   success:res=>{
			   if (res > 0) {
				  //layer信息提示
				  layer.alert('添加成功');//下面是关键代码
				  var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				  window.parent.location.reload(); // 刷新父页
				  parent.layer.close(index); //再执行关闭
				  setTimeout(function () { parent.layer.close(index) }, 30000);//延迟s
			   }
			   else {
				  layer.alert("添加失败！");
			   }
		   }
		})
		return false; // 阻止默认 form 跳转
	  });
	});
</script>